home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat3
/
Tcl
/
glxaux.z
/
glxaux
Wrap
Text File
|
1998-10-30
|
10KB
|
199 lines
GGGGLLLLXXXXAAAAUUUUXXXX((((3333TTTTkkkk)))) GGGGLLLLXXXXAAAAUUUUXXXX((((3333TTTTkkkk))))
NNNNAAAAMMMMEEEE
GLXAux - an extension to Tcl/Tk which allows IrisGL rendering
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
cc -o your_wish yourAppInit.o ... -ltkGLXAux -ltkGLX -ltk -ltcl -lgl_s
-lXext -lX11_s -lm
and, yourAppInit.c should contain:
TkGLX_Init(interp, Tk_MainWindow(interp));
if (TkGLXAux_Init(interp) == TCL_ERROR) {
return TCL_ERROR;
}
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
_G_L_X_A_u_x is a companion extension to _g_l_x_w_i_n, by Michael Halle
<mhalle@media.mit.edu>. _g_l_x_w_i_n provides a Tk widget which can be used as
a target of GL rendering. However, often many simple GL tasks would be
easier if they had Tcl bindings. _G_L_X_A_u_x provides these bindings - a
comprehensive set of Tcl bindings to IrisGL (GL 4.0). Version 1.0 of
_G_L_X_A_u_x supports pretty much everything except lighting and textures. See
the CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS NNNNOOOOTTTT SSSSUUUUPPPPPPPPOOOORRRRTTTTEEEEDDDD section for more details.
For most GL commands, the equivalent Tcl command will be the same text,
except prefixed with _g_l:. So, ccccppppaaaacccckkkk((((3333GGGG)))) would be accessed by running
_g_l:_c_p_a_c_k.
SSSSYYYYNNNNTTTTAAAAXXXX
Most _G_L_X_A_u_x commands take exactly the same arguments as their C
counterparts. Some take _g_r_o_u_p_s of arguments, such as _g_l:_c_i_r_c, which
draws a circle. Both of the following commands are equivalent:
gl:circ {10 10} 20
gl:circ 10 10 20
When a GL command occurs in many forms, such as the _v_e_r_t_e_x command (_v_2_i,
_v_2_f, _v_2_d, _v_3_i, _v_3_f, _v_3_d, ...), these have been collapsed into one Tcl
command (in this case, _g_l:_v) which takes a variable number of arguments.
When a GL command takes an _A_n_g_l_e argument, which for C programmers is an
integer in tenths of degrees, the Tcl programmer has a choice of degrees,
tenths of degrees, or radians. The current interpretation of an angle is
set with the _g_l:_a_n_g_l_e_m_o_d_e command. By default, angles are read as
degrees.
When a GL command would normally return multiple values to addressed
passed to it, such as _g_R_G_B_c_o_l_o_r(_3_G), these results are returned together
as a Tcl list.
PPPPaaaaggggeeee 1111
GGGGLLLLXXXXAAAAUUUUXXXX((((3333TTTTkkkk)))) GGGGLLLLXXXXAAAAUUUUXXXX((((3333TTTTkkkk))))
When a GL command would normally take a boolean value, such as
_b_a_c_k_b_u_f_f_e_r(_3_G), the Tcl programmer may use numbers (1 or 0) as well as
strings (if it begins with ffff, FFFF, or 0000, it's considered to be _f_a_l_s_e,
otherwise, it's _t_r_u_e).
When a GL command would normally take a Matrix, such as _l_o_a_d_m_a_t_r_i_x(_3_G),
the Tcl programmer may pass a list of lists, each containing four
numbers. This must be in row-major order.
When a GL command would normally take one of a specific number of
predefined arguments, such as _a_f_u_n_c_t_i_o_n(_3_G), which, in C, may be passed
either _A_F__N_O_T_E_Q_U_A_L or _A_F__A_L_W_A_Y_S, the Tcl programmer is restricted to use
some lower-case cleaned-up versions of these strings, in this case,
_n_o_t_e_q_u_a_l or _a_l_w_a_y_s. Other strings will generate an error.
CCCCOOOONNNNVVVVEEEENNNNIIIIEEEENNNNCCCCEEEESSSS
The Tcl variable _g_l:_i_d_e_n_t_i_t_y contains an identity matrix suitable for
passing to functions like _g_l:_l_o_a_d_m_a_t_r_i_x.
The Tcl variable _g_l_x_a_u_x:_v_e_r_s_i_o_n contains the version number of the GLXAux
library (currently 1.0).
The Tcl command _g_l:_v_i_e_w provides a higher-level abstraction for a typical
walk-through application. _g_l:_v_i_e_w works like most Tk commands, i.e.,
_g_l:_v_i_e_w _v_i_e_w_1 will create a new command, _v_i_e_w_1 which can then be
manipulated directly.
Usage: gl:view _v_i_e_w-_n_a_m_e ?_c_o_n_f_i_g_u_r_a_t_i_o_n-_p_a_r_a_m_e_t_e_r_s?
_v_i_e_w-_n_a_m_e ggggeeeetttt - returns the matrix corresponding to the current
viewing parameters.
_v_i_e_w-_n_a_m_e llllooooaaaadddd - performs a GL _l_o_a_d_m_a_t_r_i_x() of the matrix
corresponding to the current viewing parameters.
_v_i_e_w-_n_a_m_e ttttuuuurrrrnnnn____rrrriiiigggghhhhtttt _a_n_g_l_e - turns the viewer's head right, in
the viewer's coordinate system. The units for _a_n_g_l_e are
determined by the last call to _g_l:_a_n_g_l_e_m_o_d_e.
_v_i_e_w-_n_a_m_e ttttuuuurrrrnnnn____uuuupppp _a_n_g_l_e - turns the viewer's up right, in the
viewer's coordinate system. The units for _a_n_g_l_e are determined
by the last call to _g_l:_a_n_g_l_e_m_o_d_e.
_v_i_e_w-_n_a_m_e wwwwaaaallllkkkk____ffffoooorrrrwwwwaaaarrrrdddd _d_i_s_t_a_n_c_e - moves the viewer forward, in
the viewer's coordinate system.
_v_i_e_w-_n_a_m_e wwwwaaaallllkkkk____uuuupppp _d_i_s_t_a_n_c_e - moves the viewer up, in the viewer's
coordinate system.
_v_i_e_w-_n_a_m_e wwwwaaaallllkkkk____rrrriiiigggghhhhtttt _d_i_s_t_a_n_c_e - moves the viewer right, in the
viewer's coordinate system.
_v_i_e_w-_n_a_m_e ccccoooonnnnffffiiiigggguuuurrrreeee ?_c_o_n_f_i_g_u_r_a_t_i_o_n-_p_a_r_a_m_e_t_e_r_s?
Configurable options:
(if no options are passed, the current configuration is returned)
-_p_o_s_i_t_i_o_n {_x _y _z} - sets the viewer's position (VRP) to {_x _y _z}
-_f_o_r_w_a_r_d {_x _y _z} - sets the viewer's direction (VPN) to {_x _y _z}
PPPPaaaaggggeeee 2222
GGGGLLLLXXXXAAAAUUUUXXXX((((3333TTTTkkkk)))) GGGGLLLLXXXXAAAAUUUUXXXX((((3333TTTTkkkk))))
-_u_p {_x _y _z} - sets the viewer's up vector (VUV) to {_x _y _z}
-_t_a_r_g_e_t {_x _y _z} - fixes the viewer's gaze upon {_x _y _z},
regardless of any change in position. Setting the -forward value
cancels _t_a_r_g_e_t _m_o_d_e.
PPPPEEEERRRRFFFFOOOORRRRMMMMAAAANNNNCCCCEEEE
These bindings are slow. For tasks that only occur occasionally, like
clearing the screen or changing the viewpoint, there should be no
noticable slowdown. However, for tasks that occur often, like sending a
vertex to the graphics pipeline, the slowdown is quite noticable. You
should really be doing that kind of stuff in C, but it you insist on
using Tcl, use GL objects to encapsulate large collections of primitives.
See the _p_y_r_a_m_i_d_W_o_r_l_d demo program for an example of this.
CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS NNNNOOOOTTTT SSSSUUUUPPPPPPPPOOOORRRRTTTTEEEEDDDD
GL 4.0 contains many features for backward compatibility with older
versions. Many such commands don't make sense with you're using X.
Particularly, the GL font mechanisms and event mechanisms are no longer
used. Likewise, there's no need to use GL menus, since you're using
_G_L_X_A_u_x with Tcl/Tk, which provides its own menus. Object editing isn't
supported in _G_L_X_A_u_x since it isn't supported in OpenGL, which would make
porting _G_L_X_A_u_x difficult.
Some features, such as lighting, materials, NURBS, picking, fogvertex,
feedback, and texture-map/image handing, should appear in a later
release, with a higher-level Tk-style object oriented interface, where
appropriate. The _G_L_X_A_u_x 1.0 release is intended to get the work already
accomplished out on the net for people to use today.
Remember, if you need to be using some of these features, you can always
write your code in C.
SSSSUUUUPPPPPPPPOOOORRRRTTTTEEEEDDDD CCCCOOOOMMMMMMMMAAAANNNNDDDDSSSS
Note: the _s_u_b_p_i_x_w_i_n_d_o_w and _s_u_b_p_i_x_p_e_r_s_p_e_c_t_i_v_e calls aren't properly GL
calls but rather can be found in the Graphics Library Programming Guide,
v2.0, pages 15-39. These are useful for accumulation-buffer-based anti-
aliasing.
PPPPaaaaggggeeee 3333